package com.example.login.controller;

import com.example.login.entity.User;
import com.example.login.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class UserController {
    @Autowired
    UserMapper userMapper;

    //登录验证
    @RequestMapping("/login")
    public String Login(@RequestBody User user){
        String uname=user.getUname();
        String upwd=user.getUpwd();

        String res=userMapper.isExist(uname,upwd);
        if(res!=null){
            return "OK";
        }else{
            return "NG";
        }

    }
}
